package rnxextract

import (
	"gitee.com/ymofen/gobase"
	"github.com/spf13/cobra"
)

func init() {
	gobase.ArgFuncRegister("rnxExtract", gobase.ArgFuncOption{Catalog: "corbaRoot", Func: func(args string, tag interface{}) (val interface{}, err error) {
		var inputDir, outputFile string
		var cmd = &cobra.Command{
			Use:  "rnxExtract -i inputDir -o exam.txt",
			Long: "search _MO.gz|_MO.o files in inputDir, unzip and analyze, output .sta",

			Run: func(cmd *cobra.Command, args []string) {
				inputDir, _ = gobase.TryTrimSuffix(inputDir, "\\")
				inputDir, _ = gobase.TryTrimSuffix(inputDir, "/")

				rnx := NewRnxFilesExtract()
				rnx.Search(inputDir, outputFile)
			},
		}
		cmd.Flags().StringVarP(&inputDir, "inputDir", "i", "", `C:\workspace\RnxFiles`)
		cmd.Flags().StringVarP(&outputFile, "output", "o", "", `C:\workspace`)
		//cmd.Flags().StringVarP(&rover, "rover", "r", "", "conntype=ntripclient&connstr=")
		//cmd.Flags().StringVarP(&base, "base", "b", "", "conntype=ntripclient&connstr=")
		//cmd.Flags().StringVarP(&eph, "eph", "e", "", "conntype=ntripclient&connstr=")
		//golog.Infof("rtka load")
		return cmd, nil
	}})

}
